package com.dwms.feign.system;

import com.dwms.entity.*;
import com.dwms.entity.system.menu.response.MenuResponse;
import com.dwms.entity.system.role.request.RoleQueryRequest;
import com.dwms.entity.system.role.request.RoleRequest;
import com.dwms.entity.system.role.response.RoleResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @ClassName UserApi
 * @Description: 用户API
 * @Create 2022/10/19 19:37
 * @Author WH
 * @Since 1.0.0
 */
@FeignClient(value = "system-server",path = "/role")
public interface RoleFeignClient {

    /**
     * 新增角色
     * @param roleRequest
     * @return
     */
    @PostMapping("/save")
    Result save(@RequestBody RoleRequest roleRequest);

    /**
     * 修改角色
     * @param roleRequest
     * @return
     */
    @PostMapping("/update")
    Result update(@RequestBody RoleRequest roleRequest);

    /**
     * 分页查询角色
     * @param query
     * @return
     */
    @PostMapping("/findPage")
    Result<PageResponse<RoleResponse>> findPage(@RequestBody RoleQueryRequest query);

    /**
     * 根据ID查询角色
     * @param query
     * @return
     */
    @PostMapping("/findById")
    Result findById(@RequestBody QueryRequest query);

    /**
     * 删除角色
     * @param query
     * @return
     */
    @PostMapping("/delete")
    Result delete(@RequestBody QueryRequest query);

    /**
     * 角色列表查询
     * @return
     */
    @PostMapping("/findMenuByRoleId")
    Result<List<MenuResponse>> findMenuByRoleId(@RequestBody QueryRequest query);

    /**
     * 角色列表查询
     * @return
     */
    @PostMapping("/findList")
    Result<List<RoleResponse>> findList(@RequestBody Request request);

    /**
     * 修改状态
     * @param query
     * @return
     */
    @PostMapping("/updateStatus")
    Result updateStatus(@RequestBody QueryRequest query);

    /**
     * 根据用户ID查询角色
     * @param userId
     * @return
     */
    @PostMapping("/findRoleByUserId")
    Result<List<RoleVO>> findRoleByUserId(@RequestParam("userId") Long userId);

    /**
     * 根据角色ID查询菜单
     * @param roleIds
     * @return
     */
    @PostMapping("/findMenuByRoleIds")
    Result<List<String>> findMenuByRoleIds(@RequestParam("roleIds") List<Long> roleIds);

}
